home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 029a / tsbat27.zip / REZIP.BAT < prev    next >
DOS Batch File  |  1991-07-10  |  4KB  |  151 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Unzip and then zip again a .zip file to remove -av label  │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Wed 10-Jul-1991   │
  6. echo └───────────────────────────────────────────────────────────┘
  7.  
  8. rem Advanced trick: If you want to use filecards after all use:
  9. rem   for %f in (*.zip) do call rezip %f
  10. rem You must have MsDos 3.30 or later to use this trick
  11.  
  12. rem If no parameters then give the instructions
  13. if "%1"=="" goto _help
  14.  
  15. rem Check that the zip file exists
  16. if not exist %1 goto _nofile
  17.  
  18. rem Check that the ask.exe program is available
  19. set _found=
  20. if exist ask.exe set _found=yes
  21. for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
  22. if "%_found%"=="yes" goto _isunzip
  23. echo Timo's enhancer ask.exe must be at path or in the current directory
  24. goto _out
  25.  
  26. rem Check that the pkunzip.exe program is available
  27. :_isunzip
  28. set _found=
  29. if exist pkunzip.exe set _found=yes
  30. for %%d in (%path%) do if exist %%d\pkunzip.exe set _found=yes
  31. if "%_found%"=="yes" goto _ispkzip
  32. echo pkunzip.exe must be at path or in the current directory
  33. goto _out
  34.  
  35. rem Check that the pkzip.exe program is available
  36. :_ispkzip
  37. set _found=
  38. if exist pkzip.exe set _found=yes
  39. for %%d in (%path%) do if exist %%d\pkzip.exe set _found=yes
  40. if "%_found%"=="yes" goto _chk_r
  41. echo pkzip.exe must be at path or in the current directory
  42. goto _out
  43.  
  44. rem Check that there is a r: drive available
  45. :_chk_r
  46. if not exist r:\nul goto _noram
  47.  
  48. rem Make a temporary directory
  49. if not exist r:\tmp$$$\nul md r:\tmp$$$
  50.  
  51. :_isempty
  52. if not exist r:\tmp$$$\*.* goto _test
  53. echo The auxiliary directory r:\tmp$$$ is not empty
  54. :_ask1
  55. ask Delete the files (y/n)? /d /u
  56. if errorlevel==89 if not errorlevel==90 goto _del
  57. if errorlevel==78 if not errorlevel==79 goto _out
  58. goto _ask1
  59.  
  60. rem Delete files from r:\tmp$$$
  61. :_del
  62. del r:\tmp$$$\*.*
  63. goto _isempty
  64.  
  65. rem Test archive integrity
  66. :_test
  67. pkunzip -t %1
  68. if errorlevel==1 goto _unziperr
  69.  
  70. :_ask2
  71. ask Old %1 will be deleted, ok (y/n)? /d /u
  72. if errorlevel==89 if not errorlevel==90 goto _pkunzip
  73. if errorlevel==78 if not errorlevel==79 goto _out
  74. goto _ask2
  75.  
  76. rem Unzip the .zip archive
  77. :_pkunzip
  78. pkunzip %1 r:\tmp$$$
  79. if not exist r:\tmp$$$\*.zip goto _ask3
  80. echo Warning: There are .zips within %1
  81. pause
  82.  
  83. :_ask3
  84. ask Insert e:\arczip\comment.txt as zip comment (y/n)? /d /u
  85. if errorlevel==89 if not errorlevel==90 goto _com_yes
  86. if errorlevel==78 if not errorlevel==79 goto _com_no
  87. goto _ask3
  88.  
  89. rem Check that the comment.txt file program is available
  90. :_com_yes
  91. if exist e:\arczip\comment.txt goto _with_com
  92. echo e:\arczip\comment.txt not found
  93. echo Adjust the path as necessary
  94. goto _out
  95.  
  96. rem Delete and make a new .zip archive with zip comment
  97. :_with_com
  98. del %1 > nul
  99. pkzip -br:\ -mu -o -z %1 r:\tmp$$$\*.* < e:\arczip\comment.txt
  100. goto _rd
  101.  
  102. rem Delete and make a new .zip archive without zip comment
  103. :_com_no
  104. del %1 > nul
  105. pkzip -br:\ -mu -o %1 r:\tmp$$$\*.*
  106. goto _rd
  107.  
  108. :_rd
  109. pkzip -v %1
  110. rd r:\tmp$$$
  111. goto _out
  112.  
  113. rem Error messages
  114. :_nofile
  115. echo File %1 not found
  116. goto _out
  117.  
  118. :_unziperr
  119. echo Error in %1
  120. goto _out
  121.  
  122. :_noram
  123. echo You must have a (ram)disk available as drive r:
  124. goto _out
  125.  
  126. :_help
  127. echo                      ┌──────────────┐
  128. echo Usage REZIP FileName │ No wildcards │ (paths are ok)
  129. echo                      └──────────────┘
  130. echo Since someone cracked the pkzip 1.10 authenticity (-av) code some BBSes
  131. echo have been putting in their own ads as the authenticity labels. The
  132. echo purpose of this batch is to remove these labels, which may give the
  133. echo users a false sense of security.
  134. echo Note that any .zips within the .zip will not be cleaned.
  135. echo.
  136. echo You will need the following shareware and PD programs to use this batch.
  137. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  138. echo      PKUNZIP.EXE and PKZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
  139. echo      ASK.EXE from TSBAT26.ARC
  140. echo.
  141. echo Advanced trick for MsDos 3.30+: To use wildcards apply:
  142. echo   for #f in (*.zip) do call rezip #f   (# stands for ascii 37)
  143. echo If you get an "Out of environment space" message, increase your
  144. echo environment space by using shell configuration in config.sys:
  145. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  146. goto _out
  147.  
  148. :_out
  149. set _found=
  150. echo on
  151.